<template>
  <div>
    <div><h1>订单详情</h1></div>
    <el-table
      :data="OrderData.orderItems"
      border
      style="width: 100%">
      <el-table-column
        prop="barcode"
        label="商品条码"
        width="250">
      </el-table-column>
      <el-table-column
        prop="name"
        label="商品名称"
        width="250">
      </el-table-column>
      <el-table-column
        label="商品价格"
        width="250">
        <template slot-scope="scope">
          {{ scope.row.price + ' 元' }}
        </template>
      </el-table-column>
      <el-table-column
        prop="quantity"
        label="商品数量"
        width="250">
        <template slot-scope="scope">
          {{ scope.row.totalPrice + ' (' + scope.row.unit + ')'}}
        </template>
      </el-table-column>
      <el-table-column
        label="商品总价">
        <template slot-scope="scope">
          {{ scope.row.totalPrice + ' 元' }}
        </template>
      </el-table-column>
    </el-table>
    <div>合计：{{ OrderData.totalAmount + ' 元' }}</div>
    <div>下单时间：{{ OrderData.createdAt }}</div>
  </div>
</template>

<script>
import itemService from "../global/service/itemService";

export default {
  name: "OrderDetails",
  data() {
    return {
      OrderData: {}
    }
  },
  created() {
    this.id = this.$route.query.id
    itemService.getOrderDetails(this.id).then((res) => {
      this.OrderData = res
    })
  },
}
</script>

<style scoped>

</style>
